﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Text;
using Abp.Domain.Entities;
using Abp.Domain.Entities.Auditing;
using FwProject.ShoppingMall.EventAdvertising;

namespace FwProject.ShoppingMall.Shop
{

    #region ViewSelfCoupon视图的sql 语法查询用户的自己的优惠券信息
    //    select a.Id, a.OrderNumber, a.ShopCouponId, a.UserId, a.UseStatus, a.CreationTime,
    //    b.CouponCount, b.CouponDescribe, b.CouponNotPic, b.CouponPic, b.CouponTitile, b.CouponType, b.UseBeginTime, b.UseCoupon, b.UseEndTime,
    //   b.CouponType, b.CouponPrice, b.UsePrice
    //   from  shop_user_coupon a left JOIN shop_coupon b
    //   on a.ShopCouponId= b.Id
    #endregion

    /// <summary>
    /// 商品表
    /// </summary>
    [Table("ViewSelfCoupon")]
    public class ViewSelfCoupon : Entity<Guid>
    {



        /// <summary>
        /// 默认0未使用1已使用， 优惠券使用状态
        /// </summary>
        public UseStatus UseStatus { get; set; } = UseStatus.Unused;

        /// <summary>
        /// 优惠券使用后对应的订单编号
        /// </summary>
        public string OrderNumber { get; set; }

        /// <summary>
        /// 用户Id
        /// </summary>
        public long UserId { get; set; }

        /// <summary>
        /// 商城优惠券编号
        /// </summary>
        public Guid ShopCouponId { get; set; }

        public DateTime CreationTime { get; set; }
        /// <summary>
        /// 默认0全品1,单类别，使用类别
        /// </summary>
        public CouponType CouponType { get; set; } = CouponType.All;

        /// <summary>
        /// 适用范围
        /// </summary>
        public UseCoupon UseCoupon { get; set; } = UseCoupon.Universal;

        /// <summary>
        /// 优惠券金额
        /// </summary>
        public decimal CouponPrice { get; set; } = 0m;

        /// <summary>
        /// 默认0 满减使用
        /// </summary>
        public decimal UsePrice { get; set; } = 0m;

        /// <summary>
        /// 优惠券显示图片
        /// </summary>
        [Required]
        public string CouponPic { get; set; }

        public string CouponNotPic { get; set; }

        /// <summary>
        /// 开始使用时间
        /// </summary>
        public DateTime UseBeginTime { get; set; }

        /// <summary>
        /// 结束使用时间
        /// </summary>
        public DateTime UseEndTime { get; set; }

        /// <summary>
        /// 发行数量
        /// </summary>
        public int CouponCount { get; set; }

        /// <summary>
        /// 优惠券名称
        /// </summary>
        [Required]
        public string CouponTitile { get; set; }

        /// <summary>
        /// 优惠券描述
        /// </summary>
        public string CouponDescribe { get; set; }

    }
}
